/*
 * @Author: 刘思思
 * @Date: 2024-11-29 16:23:01
 * @LastEditors: 刘思思
 * @LastEditTime: 2024-11-29 16:23:11
 * @FilePath: /AdvertisingMachine/common/msgQueue/src/msgUtils.c
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
 */
#include "msgUtils.h"

int obtain_msg_queue(char *pathName,int proId){
    key_t key = ftok(pathName,proId);
    if (key == -1)
    {
       perror("fotk() error: ");
        return -1;
    }
    int msgQueueId = msgget(key,IPC_CREAT | 0666);

    if (msgQueueId == -1)
    {
       perror("msgget() error: ");
       return -1;
    }
    return msgQueueId;

}